package org.yufan.admin.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.yufan.admin.service.ItemCatService;
import org.yufan.core.bean.ItemCat;

import java.util.List;

/**
 * Created by zxd on 2019/3/4
 **/
@RequestMapping("/cat")
@ResponseBody
@Controller
public class ItemCatController {

    @Autowired
    private ItemCatService itemCatService;


    @RequestMapping(value = "/list",method = RequestMethod.POST)
    public List<ItemCat> queryItemCatByParentId(@RequestParam(value = "id",defaultValue = "0") Long parentId){
        ItemCat record=new ItemCat();
        record.setParentId(parentId);
        return itemCatService.findByWhereList(record);
    }

}
